/*
 * IConnector.h
 *
 *  Created on: Aug 12, 2012
 *      Author: nam20485
 */

#ifndef ICONNECTOR_H_
#define ICONNECTOR_H_

#include "Message.h"
#include "Packet.h"

class IConnector
{
public:
	//typedef void (*ConnectorReceiveHandler)(const Message& message);

	virtual ~IConnector()	{}

	virtual bool Connect(/*ConnectorReceiveHandler m_pfnReceiveHandler*/) = 0;
	//virtual bool Connect();//	{ return Connect(); }
	virtual bool Disconnect() = 0;

	bool Send(const Message& message);
	const Message* Receive();

protected:
	typedef unsigned char BYTE;

	const Packet* DecodePacket();
	virtual size_t ReadBytes(BYTE* pBuff, size_t count) = 0;
	virtual size_t WriteBytes(const BYTE* pBytes, size_t count) = 0;

	//ConnectorReceiveHandler m_pfnReceiveHandler;
};


#endif /* ICONNECTOR_H_ */
